[][src]Crate async_executor

Async executor.

This crate offers two kinds of executors: single-threaded and multi-threaded.

Examples

Run a single-threaded and a multi-threaded executor at the same time:

use async_channel::unbounded;
use async_executor::{Executor, LocalExecutor};
use easy_parallel::Parallel;

let ex = Executor::new();
let local_ex = LocalExecutor::new();
let (trigger, shutdown) = unbounded::<()>();

Parallel::new()
    // Run four executor threads.
    .each(0..4, |_| ex.run(shutdown.recv()))
    // Run local executor on the current thread.
    .finish(|| local_ex.run(async {
        println!("Hello world!");
        drop(trigger);
    }));

Structs

Executor

Multi-threaded executor.

LocalExecutor

Single-threaded executor.

Spawner

A spawner for a multi-threaded executor.

Task

A spawned future.